Don't set up im stuff if the widget is not realized.
authorMatthias Clasen <matthiasc@src.gnome.org>
Fri, 23 Jan 2009 06:04:05 +0000 (06:04 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 23 Jan 2009 06:04:05 +0000 (06:04 +0000)
        * gtk/gtktextview.c: Don't set up im stuff if the widget
        is not realized.

        * gtk/gtkimmodule.c: Assert that we have a window.

svn path=/trunk/; revision=22193

ChangeLog
gtk/gtkimmodule.c
gtk/gtktextview.c

index cc317f603e8bedc77cd0744ecdb7d23734d4e223..35b0a817e2bba76c8d21bc218466a0e8990771c1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2009-01-23  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 567124 – proposal to delay doing something related to 
+       immodule until widgets realized
+
+       Delay setting up immodules until the widget is realized.
+       Patch by Akira Tagoh
+       
+       * gtk/gtktextview.c: Don't set up im stuff if the widget
+       is not realized.
+
+       * gtk/gtkimmodule.c: Assert that we have a window.
 2009-01-23  Matthias Clasen  <mclasen@redhat.com>
 
        Skip Desktop if it equals the home folder
index b347abd4f296eeabc06b36a2d494238feeb61e07..274166d362fa6311a3c633af899bd7fddeb00e7d 100644 (file)
@@ -671,6 +671,9 @@ _gtk_im_module_get_default_context_id (GdkWindow *client_window)
   GdkScreen *screen;
   GtkSettings *settings;
       
+  /* assertion to make sure all of the unexpected invocation is really gone. */
+  g_return_val_if_fail (client_window != NULL, SIMPLE_ID);
+
   if (!contexts_hash)
     gtk_im_module_initialize ();
 
@@ -682,7 +685,7 @@ _gtk_im_module_get_default_context_id (GdkWindow *client_window)
 
   /* Check if the certain immodule is set in XSETTINGS.
    */
-  if (client_window != NULL && GDK_IS_DRAWABLE (client_window))
+  if (GDK_IS_DRAWABLE (client_window))
     {
       screen = gdk_drawable_get_screen (GDK_DRAWABLE (client_window));
       if (screen)
index e9bc867a91e3f675f990e22222ddda8b4d486492..6d281fd5fc2eebb9dfe19606a3f384c85d66d67d 100644 (file)
@@ -2076,7 +2076,8 @@ gtk_text_view_update_im_spot_location (GtkTextView *text_view)
    */
   area.width = 0;
 
-  gtk_im_context_set_cursor_location (text_view->im_context, &area);
+  if (GTK_WIDGET_REALIZED (text_view))
+    gtk_im_context_set_cursor_location (text_view->im_context, &area);
 }
 
 static gboolean
@@ -3837,6 +3838,9 @@ gtk_text_view_realize (GtkWidget *widget)
       
       tmp_list = tmp_list->next;
     }
+
+  /* Ensure updating the spot location. */
+  gtk_text_view_update_im_spot_location(text_view);
 }
 
 static void